package projects.jnurse.ioc.core.instrument;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;

/**
 * Created by Adil Naji.
 * User: XP-170708
 * Date: 16 nov. 2008
 * Time: 21:51:45
 */
public class SimpleTransformer implements ClassFileTransformer {

    public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

        System.out.println("ghggjgj");
        return classfileBuffer;

        /*try {
            ClassReader cr = new ClassReader(classfileBuffer);
            ClassWriter cw = new ClassWriter(cr, 0);
            ClassAdapter ca = new IocFieldAdapter(cw);
            //ClassVisitor cv = new IocClassVisitor();
            cr.accept(ca, 0);
            return cw.toByteArray();
            //return b;
            //cr.getClass().getClassLoader();
            //return cl.defineClass(clazz.getName(), b);
        } catch(Exception e) {
            e.printStackTrace();
        }
        return classfileBuffer;*/
    }
}
